from enum import Flag

"""
flag: 可将枚举值组合
"""


class Color(Flag):
    RED = 1
    GREEN = 2
    BLUE = 4
    YELLOW = 8
    BLACK = 16


for color in Color:
    print(color)

yellow_and_blue = Color.YELLOW | Color.BLUE
print(yellow_and_blue.value)  # 12
print(yellow_and_blue)  # Color.BLUE|YELLOW
for color in yellow_and_blue:
    print(color)

if Color.RED in yellow_and_blue:
    print("RED is in yellow_and_blue")
else:
    print("RED is not in yellow_and_blue")
